/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Setting.java
 *
 * Created on Oct 21, 2010, 11:41:03 AM
 */

package cat200;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Setting.java
 *
 * Created on Oct 21, 2010, 11:41:03 AM
 */

import java.sql.*;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.swing.JOptionPane;

/**
 *
 * @author peichia
 */
public class Setting extends javax.swing.JFrame {
	
	private static String dbURL = "jdbc:derby://localhost:1527/sample;create=true;user=app;password=app";
    private static Connection conn = null;
    private static Statement stmt = null;
    DecimalFormat dp = new DecimalFormat("#0.00");
    
	public static int id_passing;
	int row_index,col_index;
    String s_data = "";
    int i = 0;
    String []n1 = new String[100];
    String []n2 = new String[100];
    String []n3 = new String[100];
    String []n4 = new String[100];
    String []n5 = new String[100];
    String []n6 = new String[100];
    
    int a = 0;
    int b = 0;
    
    String sale = "";
	double sale1 = 0;
	double total_s = 0;
	
	String inv = "";
	double inv1 = 0;
	double total_i = 0;
	double total_G = 0;

	Object Date,Month,Year;
	String D,Y,M = "";
	String DATE = "";
	
	String p_sale = "";
	double p_sale1 = 0;
	double p_total_s = 0;
	
	String p_inv = "";
	double p_inv1 = 0;
	double p_total_i = 0;
	double p_total_G = 0;
	
	
    /** Creates new form Setting */
    public Setting() {
    	super("Setting");
        initComponents();  
        setLocationRelativeTo(null);
        jTextField9.setEditable(false);
        jTextField8.setEditable(false);
        
    }
    
    public Setting(int id) {
    	 super("Setting");
    	 initComponents();
    	 id_passing = id;
         setLocationRelativeTo(null);
         display_cake();
         display_emp();
         emp_Num();
         mem_Num();
         cake_Num();
         today_sale();
         jTextField9.setEditable(false);
         jTextField8.setEditable(false);
    	
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        tabPane = new javax.swing.JTabbedPane();
        empTab = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        jButton6 = new javax.swing.JButton();
        jPanel28 = new javax.swing.JPanel();
        jPanel29 = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        jButton8 = new javax.swing.JButton();
        jPanel30 = new javax.swing.JPanel();
        jButton17 = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        jPanel31 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jButton18 = new javax.swing.JButton();
        jPanel32 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        jButton19 = new javax.swing.JButton();
        cakeTab = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jButton5 = new javax.swing.JButton();
        jPanel22 = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jButton7 = new javax.swing.JButton();
        jPanel24 = new javax.swing.JPanel();
        jButton14 = new javax.swing.JButton();
        jLabel17 = new javax.swing.JLabel();
        jPanel25 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jButton15 = new javax.swing.JButton();
        jPanel26 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jButton16 = new javax.swing.JButton();
        anaTab = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        empNum = new javax.swing.JLabel();
        memNum = new javax.swing.JLabel();
        cakeNum = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        date = new javax.swing.JLabel();
        totalSales = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jComboBox3 = new javax.swing.JComboBox();
        jLabel38 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel39 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jLabel40 = new javax.swing.JLabel();
        preSales = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
  
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        empTab.setMinimumSize(new java.awt.Dimension(700, 500));

        jPanel27.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "EMPLOYEE TABLE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 24), new java.awt.Color(171, 63, 138))); // NOI18N

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Emp ID", "Emp Name", "Emp IC", "Emp Phone","Emp Address","Emp Position"
            }
        ));
        jTable4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable4MouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(jTable4);

        jButton6.setText("BACK");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel27Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel27Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton6)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel28.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "OPTION", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 0, 24), new java.awt.Color(246, 144, 227))); // NOI18N
        jPanel28.setPreferredSize(new java.awt.Dimension(195, 200));

        jPanel29.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel20.setText(" SEARCH BY ID");

        jButton8.setText("SEARCH");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel29Layout = new javax.swing.GroupLayout(jPanel29);
        jPanel29.setLayout(jPanel29Layout);
        jPanel29Layout.setHorizontalGroup(
            jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel29Layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton8))
            .addGroup(jPanel29Layout.createSequentialGroup()
                .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel29Layout.setVerticalGroup(
            jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel29Layout.createSequentialGroup()
                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField9, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                    .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel30.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jButton17.setText("ADD");
        jButton17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton17ActionPerformed(evt);
            }
        });

        jLabel21.setText("         ADD EMPLOYEE");
        jLabel21.setPreferredSize(new java.awt.Dimension(10, 25));

        javax.swing.GroupLayout jPanel30Layout = new javax.swing.GroupLayout(jPanel30);
        jPanel30.setLayout(jPanel30Layout);
        jPanel30Layout.setHorizontalGroup(
            jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel30Layout.createSequentialGroup()
                .addGroup(jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel30Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                .addGap(45, 45, 45))
        );
        jPanel30Layout.setVerticalGroup(
            jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel30Layout.createSequentialGroup()
                .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton17)
                .addContainerGap())
        );

        jPanel31.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel22.setText("  DELETE EMPLOYEE");

        jButton18.setText("DELETE");
        jButton18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton18ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel31Layout = new javax.swing.GroupLayout(jPanel31);
        jPanel31.setLayout(jPanel31Layout);
        jPanel31Layout.setHorizontalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel31Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel31Layout.createSequentialGroup()
                .addContainerGap(51, Short.MAX_VALUE)
                .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(42, 42, 42))
        );
        jPanel31Layout.setVerticalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel31Layout.createSequentialGroup()
                .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel32.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel23.setText("EDIT EMPLOYEE PROFILE");

        jButton19.setText("EDIT");
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel32Layout = new javax.swing.GroupLayout(jPanel32);
        jPanel32.setLayout(jPanel32Layout);
        jPanel32Layout.setHorizontalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel32Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel32Layout.createSequentialGroup()
                        .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel32Layout.createSequentialGroup()
                        .addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(40, 40, 40))))
        );
        jPanel32Layout.setVerticalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel32Layout.createSequentialGroup()
                .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton19, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
        jPanel28.setLayout(jPanel28Layout);
        jPanel28Layout.setHorizontalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel29, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel30, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel31, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel32, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel28Layout.setVerticalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel28Layout.createSequentialGroup()
                .addComponent(jPanel29, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel30, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout empTabLayout = new javax.swing.GroupLayout(empTab);
        empTab.setLayout(empTabLayout);
        empTabLayout.setHorizontalGroup(
            empTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(empTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(52, Short.MAX_VALUE))
        );
        empTabLayout.setVerticalGroup(
            empTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, empTabLayout.createSequentialGroup()
                .addContainerGap(31, Short.MAX_VALUE)
                .addGroup(empTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, 437, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28))
        );

        tabPane.addTab("EMPLOYEE", empTab);

        cakeTab.setMinimumSize(new java.awt.Dimension(700, 500));

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CAKE TABLE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 24), new java.awt.Color(171, 63, 138))); // NOI18N

        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Cake Code", "Cake neme", "Cake Description"
            }
        ));
        jTable3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable3MouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(jTable3);

        jButton5.setText("BACK");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton5)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "OPTION", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Sans", 0, 24), new java.awt.Color(246, 144, 227))); // NOI18N
        jPanel22.setPreferredSize(new java.awt.Dimension(195, 200));

        jPanel23.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel16.setText(" SEARCH BY CAKECODE");

        jButton7.setText("SEARCH");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton7))
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel23Layout.setVerticalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel23Layout.createSequentialGroup()
                .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                    .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel24.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jButton14.setText("ADD");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        jLabel17.setText("         ADD CAKE");
        jLabel17.setPreferredSize(new java.awt.Dimension(10, 25));

        javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
        jPanel24.setLayout(jPanel24Layout);
        jPanel24Layout.setHorizontalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel24Layout.createSequentialGroup()
                .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel24Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel24Layout.createSequentialGroup()
                        .addGap(40, 40, 40)
                        .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel24Layout.setVerticalGroup(
            jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel24Layout.createSequentialGroup()
                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton14)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel25.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel18.setText("  DELETE CAKE");

        jButton15.setText("DELETE");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel25Layout.createSequentialGroup()
                .addContainerGap(31, Short.MAX_VALUE)
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(36, 36, 36))
        );
        jPanel25Layout.setVerticalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel26.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel19.setText("EDIT CAKE PROFILE");

        jButton16.setText("EDIT");
        jButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton16ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
        jPanel26.setLayout(jPanel26Layout);
        jPanel26Layout.setHorizontalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel26Layout.createSequentialGroup()
                .addGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel26Layout.createSequentialGroup()
                        .addGap(42, 42, 42)
                        .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel26Layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel26Layout.setVerticalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel26Layout.createSequentialGroup()
                .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton16, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel26, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel25, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel24, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel23, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout cakeTabLayout = new javax.swing.GroupLayout(cakeTab);
        cakeTab.setLayout(cakeTabLayout);
        cakeTabLayout.setHorizontalGroup(
            cakeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cakeTabLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(31, Short.MAX_VALUE))
        );
        cakeTabLayout.setVerticalGroup(
            cakeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cakeTabLayout.createSequentialGroup()
                .addContainerGap(22, Short.MAX_VALUE)
                .addGroup(cakeTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, 437, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37))
        );

        tabPane.addTab("CAKE", cakeTab);

        anaTab.setLayout(null);

        jLabel28.setText("Overall Total Value");
        anaTab.add(jLabel28);
        jLabel28.setBounds(40, 70, 150, 30);

        jLabel29.setText("Number of Employee :");
        anaTab.add(jLabel29);
        jLabel29.setBounds(40, 120, 160, 30);

        jLabel30.setText("Number of Member   :");
        anaTab.add(jLabel30);
        jLabel30.setBounds(40, 180, 160, 30);

        jLabel31.setText("Number of Cake        : ");
        anaTab.add(jLabel31);
        jLabel31.setBounds(40, 240, 160, 30);
        anaTab.add(empNum);
        empNum.setBounds(190, 120, 70, 30);
        anaTab.add(memNum);
        memNum.setBounds(190, 180, 70, 30);
        anaTab.add(cakeNum);
        cakeNum.setBounds(190, 240, 60, 30);

        jLabel32.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Analysis", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 3, 24), new java.awt.Color(44, 42, 225))); // NOI18N
        anaTab.add(jLabel32);
        jLabel32.setBounds(20, 30, 270, 350);

        jLabel34.setText("Date                :");
        anaTab.add(jLabel34);
        jLabel34.setBounds(350, 80, 120, 40);

        jLabel35.setText("Total Sales     :  RM");
        anaTab.add(jLabel35);
        jLabel35.setBounds(350, 130, 140, 40);
        anaTab.add(date);
        date.setBounds(470, 80, 90, 40);
        anaTab.add(totalSales);
        totalSales.setBounds(480, 130, 110, 40);

        jLabel33.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Today's Sales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 3, 24), new java.awt.Color(44, 42, 225))); // NOI18N
        anaTab.add(jLabel33);
        jLabel33.setBounds(310, 30, 340, 170);

        jLabel37.setText("Date     : ");
        anaTab.add(jLabel37);
        jLabel37.setBounds(340, 260, 70, 30);

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12","13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24","25", "26", "27", "28", "29","30","31" }));
        anaTab.add(jComboBox3);
        jComboBox3.setBounds(410, 260, 60, 25);

        jLabel38.setText("/");
        anaTab.add(jLabel38);
        jLabel38.setBounds(480, 260, 20, 30);

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
        anaTab.add(jComboBox2);
        jComboBox2.setBounds(490, 260, 60, 25);

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015" }));
        anaTab.add(jComboBox1);
        jComboBox1.setBounds(570, 260, 80, 25);

        jLabel39.setText("/");
        anaTab.add(jLabel39);
        jLabel39.setBounds(560, 260, 20, 30);

        jButton3.setText("ENTER");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        anaTab.add(jButton3);
        jButton3.setBounds(340, 310, 100, 27);

        jLabel40.setText("Sales    :    RM");
        anaTab.add(jLabel40);
        jLabel40.setBounds(470, 310, 100, 30);
        anaTab.add(preSales);
        preSales.setBounds(570, 310, 80, 30);

        jLabel36.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Previous Sales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 3, 24), new java.awt.Color(44, 42, 225))); // NOI18N
        anaTab.add(jLabel36);
        jLabel36.setBounds(320, 210, 340, 170);

        jButton4.setText("BACK");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        anaTab.add(jButton4);
        jButton4.setBounds(30, 420, 80, 27);

        tabPane.addTab("ANALYSIS", anaTab);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 682, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabPane)
        );

        pack();
    }// </editor-fold>                        

    private void jTable3MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
    	row_index =jTable3.getSelectedRow();
        col_index =jTable3.getSelectedColumn();
        Object data = jTable3.getValueAt(row_index, 0);
        s_data = data.toString();
        System.out.println("data =" + data);
        jTextField8.setText(s_data);
    	
}                                  

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
      this.setVisible(false);
      new Main(id_passing).setVisible(true);
}                                        

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
    	//s_data = jTextField8.getText();
    	if(s_data!=""){
        this.setVisible(false);
        new view_cake(s_data).setVisible(true);
        }else{
        	JOptionPane.showMessageDialog(null, "Please select a data !");
        }
}                                        

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        this.setVisible(false);
        new add_cake().setVisible(true);
}                                         

    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        if(s_data!=""){
        this.setVisible(false);
        new del_cake(s_data).setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null, "Please select a data !");
        }
        
}                                         

    private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:

        if(s_data!=""){
        this.setVisible(false);
        new edit_cake(s_data).setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null, "Please select a data !");
        }
}                                         

    private void jTable4MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
    	row_index =jTable4.getSelectedRow();
        col_index =jTable4.getSelectedColumn();
        Object data = jTable4.getValueAt(row_index, 0);
        s_data = data.toString();
        System.out.println("data =" + data);
        jTextField9.setText(s_data);
    }                                    

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
      this.setVisible(false);
      new Main(id_passing).setVisible(true);
    }                                        

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        //s_data = jTextField9.getText();
        if(s_data!=""){
        this.setVisible(false);
        new view_emp(s_data).setVisible(true);
        }
        else{
            JOptionPane.showMessageDialog(null, "Please select a data !");
        }
    }                                       

    private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
         this.setVisible(false);
        new add_emp().setVisible(true);

    }                                         

    private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        
        if(s_data!=""){
        this.setVisible(false);
        new del_emp(s_data).setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null, "Please select a data !");
        }
    }                                         

    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        
        if(s_data!=""){
        this.setVisible(false);
        new edit_emp(s_data).setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null, "Please select a data !");
        }
    }                                         

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        this.setVisible(false);
        new Main(id_passing).setVisible(true);
}                                        

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {   
        // TODO add your handling code here:
    	Date=jComboBox3.getSelectedItem();
        Month=jComboBox2.getSelectedItem();
        Year=jComboBox1.getSelectedItem();
        
        D = Date.toString();
        M = Month.toString();
        Y = Year.toString();
        DATE = Y+"-"+M+"-"+D;

        System.out.println(DATE);
        
        try
        {

            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            //Get a connection
            conn = DriverManager.getConnection(dbURL);

            System.out.println("Database connected");
            Statement stmt = conn.createStatement();

            String sql= "SELECT SALES_TOTAL FROM APP.SALES where " + "SALES_DATE = '"+DATE+"'";
            ResultSet rset = stmt.executeQuery(sql);

              while (rset.next()){
              p_sale = rset.getString(1);
              p_sale1 = Double.parseDouble(p_sale);
              p_total_s = p_total_s + p_sale1;
              
            }
              
            String sql1= "SELECT INVL_TOTALCOST FROM APP.INVOICE where " + "INV_DATE = '"+DATE+"'";
            ResultSet rset1 = stmt.executeQuery(sql1);

                while (rset1.next()){
                p_inv = rset1.getString(1);
                p_inv1 = Double.parseDouble(p_inv);
                p_total_i = p_total_i + p_inv1;
                
              }
              
            p_total_G = p_total_s + p_total_i;
            
            String see3  = dp.format(p_total_G);
            preSales.setText("   "+see3);
            
            p_sale = "";
        	p_sale1 = 0;
        	p_total_s = 0;
        	
        	p_inv = "";
        	p_inv1 = 0;
        	p_total_i = 0;
        	p_total_G = 0;

        }
        catch (Exception except)
        {
            except.printStackTrace();
        }
        
        
        
    }  
    
    private void display_cake(){
    	int i=0;
    	try
        {
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            //Get a connection
            conn = DriverManager.getConnection(dbURL);

            System.out.println("Database connected");
            Statement stmt = conn.createStatement();
           
            String sql = "select CAKE_CODE,CAKE_NAME,CAKE_DESCRIP from APP.CAKE ";

            ResultSet rset = stmt.executeQuery(sql);

            while (rset.next()){

               jTable3.setValueAt(rset.getString(1),i,0);
               jTable3.setValueAt(rset.getString(2),i,1);
               jTable3.setValueAt(rset.getString(3),i,2);
               i++;
            }   
            
        }
        catch (Exception except)
        {
            except.printStackTrace();
        }
    	
    }
    
private void display_emp(){
    	
    	try
        {
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            //Get a connection
            conn = DriverManager.getConnection(dbURL);

            System.out.println("Database connected");
            Statement stmt = conn.createStatement();
           
            String sql = "select EMP_ID,EMP_NAME,EMP_IC,EMP_PHONE,EMP_ADDRESS,EMP_POSITION from APP.EMPLOYEE ";

            ResultSet rset = stmt.executeQuery(sql);

            while (rset.next()){

               n1[i]= rset.getString(1);
               n2[i] = rset.getString(2);
               n3[i]= rset.getString(3);
               n4[i]= rset.getString(4);
               n5[i] = rset.getString(5);
               n6[i] = rset.getString(6);
               i++;
            }

           for(int a = 0;a<i ; a++){
        	  
            jTable4.setValueAt(n1[a],a,0);
           	jTable4.setValueAt(n2[a],a,1);
            jTable4.setValueAt(n3[a],a,2);
            jTable4.setValueAt(n4[a],a,3);
            jTable4.setValueAt(n5[a],a,4);
            jTable4.setValueAt(n6[a],a,5);
            
           }      
            
        }
        catch (Exception except)
        {
            except.printStackTrace();
        }
    	
    }
    
    private void emp_Num(){
    	
    	String temp = "";
    	try
         {

             Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
             //Get a connection
             conn = DriverManager.getConnection(dbURL);

             System.out.println("Database connected");
             Statement stmt = conn.createStatement();

             String sql= "SELECT EMP_ID FROM APP.EMPLOYEE ";
             ResultSet rset = stmt.executeQuery(sql);


               while (rset.next()){
               temp = rset.getString(1);
               a++;
             }
             String see  = Integer.toString(a);
             empNum.setText("   "+see);

         }
         catch (Exception except)
         {
             except.printStackTrace();
         }
    	
    }
    
    private void mem_Num(){
    	
    	String temp1 = "";
    	try
         {

             Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
             //Get a connection
             conn = DriverManager.getConnection(dbURL);

             System.out.println("Database connected");
             Statement stmt = conn.createStatement();

             String sql= "SELECT MEM_ID FROM APP.MEMBER ";
             ResultSet rset = stmt.executeQuery(sql);

               while (rset.next()){
               temp1 = rset.getString(1);
               b++;
             }
             String see1  = Integer.toString(b);
             memNum.setText("   "+see1);

         }
         catch (Exception except)
         {
             except.printStackTrace();
         }
    	
    }
    
    private void cake_Num(){
    	
    	int temp1 = 0;
    	try
         {

             Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
             //Get a connection
             conn = DriverManager.getConnection(dbURL);

             System.out.println("Database connected");
             Statement stmt = conn.createStatement();

             String sql= "SELECT COUNT(CAKE_CODE) FROM APP.CAKE ";
             ResultSet rset = stmt.executeQuery(sql);

               while (rset.next()){
               temp1 = rset.getInt(1);
             }
             String see1  = Integer.toString(temp1);
             cakeNum.setText("   "+see1);

         }
         catch (Exception except)
         {
             except.printStackTrace();
         }
    	
    }
    
    private void today_sale(){
    	
    	Calendar cal = new GregorianCalendar();
        int month = cal.get(Calendar.MONTH);
        int year = cal.get(Calendar.YEAR);
        int day = cal.get(Calendar.DAY_OF_MONTH);
        System.out.println("Current date : " + day + "/" + (month + 1) + "/" + year);
        String m = Integer.toString(month+1);
        String y = Integer.toString(year);
        String d = Integer.toString(day);
        date.setText(d + "/" + m + "/" +y+"");
        
        String dat = y+"-"+m+"-"+d;
        System.out.println(dat);
        
        try
        {

            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            //Get a connection
            conn = DriverManager.getConnection(dbURL);

            System.out.println("Database connected");
            Statement stmt = conn.createStatement();

            String sql= "SELECT SALES_TOTAL FROM APP.SALES where " + "SALES_DATE = '"+dat+"'";
            ResultSet rset = stmt.executeQuery(sql);

              while (rset.next()){
              sale = rset.getString(1);
              sale1 = Double.parseDouble(sale);
              total_s = total_s + sale1;
              
            }
              
            String sql1= "SELECT INVL_TOTALCOST FROM APP.INVOICE where " + "INV_DATE = '"+dat+"'";
            ResultSet rset1 = stmt.executeQuery(sql1);

                while (rset1.next()){
                inv = rset1.getString(1);
                inv1 = Double.parseDouble(inv);
                total_i = total_i + inv1;
                
              }
              
            total_G = total_s + total_i;
            
            String see2  = dp.format(total_G);
            totalSales.setText("   "+see2);
            
            sale = "";
        	sale1 = 0;
        	total_s = 0;
        	
        	inv = "";
        	inv1 = 0;
        	total_i = 0;
        	total_G = 0;

        }
        catch (Exception except)
        {
            except.printStackTrace();
        }
        
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Setting().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JPanel anaTab;
    private javax.swing.JLabel cakeNum;
    private javax.swing.JPanel cakeTab;
    private javax.swing.JLabel date;
    private javax.swing.JLabel empNum;
    private javax.swing.JPanel empTab;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton18;
    private javax.swing.JButton jButton19;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JLabel memNum;
    private javax.swing.JLabel preSales;
    private javax.swing.JTabbedPane tabPane;
    private javax.swing.JLabel totalSales;
    // End of variables declaration                   

}
